import request from '../utils/request.js'

// 账号密码登录
export function loginByPassword(data) {
  return request({
    url: 'http://localhost:9999/uums-server/login',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data: new URLSearchParams({
      username: data.username,
      password: data.password
    })
  })
}

// 发送验证码
export function sendVerificationCode(data) {
  return request({
    url: 'http://localhost:9999/uums-server/verification/send-code',
    method: 'post',
    data: {
      phone: data.phone
    }
  })
}

// 验证码登录
export function loginByVerificationCode(data) {
  return request({
    url: 'http://localhost:9999/uums-server/verification/login',
    method: 'post',
    data: {
      phone: data.phone,
      code: data.code
    }
  })
} 